/*
 * Copyright 2012 alex.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.mkdir.model.embeddable;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author alex
 */
@Embeddable
public class FelhasznaloSzerepkorPK implements Serializable {
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 254)
    @Column(name = "EMAIL")
    private String email;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "SZEREPKOR")
    private String szerepkor;

    public FelhasznaloSzerepkorPK() {
    }

    public FelhasznaloSzerepkorPK(String email, String szerepkor) {
        this.email = email;
        this.szerepkor = szerepkor;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getSzerepkor() {
        return szerepkor;
    }

    public void setSzerepkor(String szerepkor) {
        this.szerepkor = szerepkor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (email != null ? email.hashCode() : 0);
        hash += (szerepkor != null ? szerepkor.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FelhasznaloSzerepkorPK)) {
            return false;
        }
        FelhasznaloSzerepkorPK other = (FelhasznaloSzerepkorPK) object;
        if ((this.email == null && other.email != null) || (this.email != null && !this.email.equals(other.email))) {
            return false;
        }
        if ((this.szerepkor == null && other.szerepkor != null) || (this.szerepkor != null && !this.szerepkor.equals(other.szerepkor))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.mkdir.model.FelhasznaloSzerepkorPK[ email=" + email + ", szerepkor=" + szerepkor + " ]";
    }
    
}
